怎麼檢查 object 是不是空的?


Posted by Rich on 2021-09-12

有時候會有這種需求,這次解決的幫手是:

let obj = {}
if (Object.keys(obj).length === 0) //true

怕忘記,紀錄一下。










Related Posts

Laptop Repair Singapore: Navigating the Maze of Technical Glitches with Expert Solutions

Laptop Repair Singapore: Navigating the Maze of Technical Glitches with Expert Solutions

重載父類別元素 (當類別裡含有自己的類別List的時候)

重載父類別元素 (當類別裡含有自己的類別List的時候)

筆記、[NET101] 網路基礎概論 (3)

筆記、[NET101] 網路基礎概論 (3)


Comments